#include <iostream>
#include <string>

using namespace std;

int main(){
	string a,b;
	cin >> a;
	cin >> b;
	cout << min(a,b) << endl << max(a,b);
}
